import React, { Component } from "react";
import axios from "axios";

import "./App.less";
import "antd/dist/antd.less";

import { BrowserRouter, Switch, Route, Redirect } from "react-router-dom";
import Login from "./pages/Login";
import Home from "./pages/Home";

export default class App extends Component {
  state = {};

  render() {
    return (
      <div className="App">
        <BrowserRouter>
          <Switch>
            <Route path="/login" component={Login} />
            <Route path="/home" component={Home} />
            <Redirect to="/login" />
          </Switch>
        </BrowserRouter>
      </div>
    );
  }

  componentDidMount() {
    axios.get("/api/restful/:id/list").then(
      (response) => {
        console.log(response.data);
      },
      (error) => {
        console.log(error);
      }
    );
  }
}
